<template>
	<view class="content">
		<text style="font-size: 32rpx;">{{detailData.noticeTitle}}</text>
		<view style="display: flex;margin-top: 20upx;">
			<text style="font-size: 24rpx;color: #8f8f94;">{{detailData.updateTime}}</text>
		</view>
		<text style="margin-top: 20upx;color: #808080;">{{detailData.noticeContent}}</text>
	</view>
</template>

<script>
	
	export default {
	    data() {
	        return {
				noticeId:0,
	            detailData: {}
	        }
	    },
	    onLoad(option) {
			var that=this;
	        that.noticeId=option.noticeId
	    },
		onShow(){
			this.checkToken();
		},
	    onPullDownRefresh() {
	       
	    },
	    onReachBottom() {
	        
	    },
	    methods: {
	       checkToken() //查用户信息
	       {
	       	var that=this;
	       	 uni.getStorage({
	       	    key: 'token',
	       	    success: function (res) {
	       			
	       			that.getNotice(res.data);
	       	    },
	       		fail:function(error){
	       			uni.navigateTo({
	       				url: `/pages/login/login`
	       			})
	       		}});
	       },
	       //获取首页通知
	       getNotice(token){
	       	var that=this;
	       	uni.request({
	       			url: that.serverUrl + '/core/api/v1/common/notice/'+that.noticeId,
	       			method: "GET",
	       			header: {
	       				'content-type': 'application/json',
	       				'Authorization': 'Bearer '+token
	       			},
	       			success: (res) => {
	       				if (res.data.code == 200) {
	       					that.detailData=res.data.data;
	       					console.log(that.detailData);
	       				}
	       			},
	       			fail: (error) => {
	       				console.log(error);
	       			}
	       		})
	       },
	       
	    }
	}
	
</script>

<style lang="scss" scoped>
	.content {
		display: flex;
		flex-direction: column;
		margin-top: 40upx;
		padding: 0 4%;
	}
</style>
